﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.ComponentModel.DataAnnotations;
using IndoReputation.Commons;

namespace IndoReputation.Views.ViewModels
{
    public class UsersViewModel
    {
        public int ID { get; set; }

        [Required(ErrorMessage = "Please choose Country")]
        public int CountryID { get; set; }
        public IEnumerable<SelectListItem> Country { get; set; }
       
        public string RegionName { get; set; }

        public string OrganizationName { get; set; }

        public string DialogPartnerName { get; set; }

        [Required(ErrorMessage = "Please choose Country")]
        public int OfficeID { get; set; }
        public IEnumerable<SelectListItem> Office { get; set; }

        [RegularExpression(@"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$", ErrorMessage = "Please enter valid e-mail adress")]
        [Required(ErrorMessage = "Please type the Login Name")]
        [DataType(DataType.EmailAddress)]
        [Display(Name = "Login Name (Please type your email)")]
        [StringLength(256, ErrorMessage = "String may not be longer than 256 characters")]
        [Remote("EmailAddressUsed", "Users", ErrorMessage = "Email Address Already On System")]
        [PlaceHolder("Enter login name here")]
        public string LoginName
        {
            set;
            get;
        }

        [DataType(DataType.Password)]
        [Required(ErrorMessage = "Please type the Password")]
        [StringLength(256, ErrorMessage = "Password need 6 to 256 characters", MinimumLength = 6)]
        public string Password
        {
            set;
            get;
        }

        [Compare("Password", ErrorMessage = "Your password does not match")]
        [DataType(DataType.Password)]
        [Display(Name = "Confirm Password")]
        [StringLength(256, ErrorMessage = "String may not be longer than 256 characters")]
        public string ConfirmPassword { get; set; }

        [StringLength(256, ErrorMessage = "String may not be longer than 256 characters")]
        [PlaceHolder("Enter full name here")]
        public string FullName
        {
            set;
            get;
        }

        [StringLength(256, ErrorMessage = "String may not be longer than 256 characters")]
        [PlaceHolder("Enter mobile phone here")]
        public string Telephone
        {
            set;
            get;
        }

        [Required(ErrorMessage = "Please type the MemoryWord")]
        [StringLength(256, ErrorMessage = "String may not be longer than 256 characters")]
        [Display(Name = "Memory Word (This will be use when you forgot your password)")]
        [PlaceHolder("Enter memory word here")]
        public string MemoryWord
        {
            set;
            get;
        }

        public DateTime? CreateAt
        {
            set;
            get;
        }
        public int? CreateBy
        {
            set;
            get;
        }

        private bool _IsEnable = true;
        public bool IsEnable
        {
            get { return _IsEnable; }
            set { _IsEnable = value; }
        }
    }

    public class UserLoginViewModel
    {
        [RegularExpression(@"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$", ErrorMessage = "Please enter valid e-mail adress")]
        [Required(ErrorMessage = "Please type the Login Name")]
        [DataType(DataType.EmailAddress)]
        [Display(Name = "Login Name")]
        [StringLength(256, ErrorMessage = "String may not be longer than 256 characters")]
        public string LoginName { get; set; }
        [DataType(DataType.Password)]
        [Required(ErrorMessage = "Please type the Password")]
        [StringLength(256, ErrorMessage = "String may not be longer than 256 characters")]
        public string Password { get; set; }
    }
}